<template>
  <div class="hometab top_shadow">
      <tab bgc="pink">
        <template>
          <tab-item v-for="item in datas" :key="item.id" @click.native="tabClick(item)">
            <template>
              <span :class="{cur:cur==item.id}">{{item.title}}</span>
            </template>
          </tab-item>
        </template>
      </tab>
    
  </div>
</template>

<script>
import Tab from "components/public/tab/Tab";
import TabItem from "components/public/tab/TabItem"
import StickyBox from "components/public/sticky_box/StickyBox";
export default {
  name: "HomeTab",
  props: {
    datas: {
      type: Array
    },
    offsetTop:{
      type:Number
    }
  },
  data(){
  return {
    cur:1
  }
},
methods:{
  tabClick(item){
    this.cur=item.id;
    this.$bus.$emit('tabClick',this.cur);
    window.scrollTo(0,this.offsetTop)

    
  }
},
  components: {
    Tab,
    TabItem,
    StickyBox
  }
};
</script>

<style lang="less" scoped>
.hometab {
  font-size: 16px;
 
}
</style>